﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using NDeployer.Common;
using NDeployer.Studio.Events;

namespace NDeployer.Studio.ViewModels
{
    public class MDIHostViewModel : ViewModelBase
    {
        public MDIHostViewModel()
        {
        }

        protected override void SubscribeToEvents()
        {
            var evt = EventAggregatorSingleton.Instance.GetEvent<NewTaskDesigner>();
            evt.Subscribe(
                a => ViewModels.Add(new TaskWorkflowViewModel()),
                Microsoft.Practices.Prism.Events.ThreadOption.UIThread,
                true);
        }

        private ObservableCollection<MDIElementViewModelBase> viewModels;
        public ObservableCollection<MDIElementViewModelBase> ViewModels
        {
            get
            {
                if (viewModels == null)
                    viewModels = new ObservableCollection<MDIElementViewModelBase>();
                return viewModels;
            }
        }

        private MDIElementViewModelBase currentViewModel;
        public MDIElementViewModelBase CurrentViewModel
        {
            get { return currentViewModel; }
            set
            {
                currentViewModel = value;
                OnNotifyPropertyChanged("CurrentViewModel");
            }
        }

    }
}
